package com.example.back.mapper;

import com.example.back.entity.Notice;
import org.apache.ibatis.annotations.*;

import java.io.Serializable;
import java.util.ArrayList;

@Mapper
public interface NoticeMapper {
    @Insert("insert into notice(id,userId,time,text,url) values(#{id},#{userId},#{time},#{text},#{url})")
    int addNotice(Notice notice);

    @Delete("delete from notice where id= #{id}")
    int deleteNotice(Serializable id);

    @UpdateProvider(type = NoticeMapperProvider.class, method = "getUpdateNoticeSql")
    int updateNotice(Notice notice);

    @Select("select id,userId,time,text,url from notice where id= #{id}")
    Notice selectNoticeById(Serializable id);

    @SelectProvider(type = NoticeMapperProvider.class, method = "getSelectNoticeSql")
    ArrayList<Notice> selectNotice(Notice notice);
}
